<?php
require("../../../../../../wp-config.php");
global $wpdb;
$id = $_GET['id'];
function cronjob_get_option($option, $user_id = 0, $default = false) {
            global $wpdb;

            if (false) {
                $optionTable = $wpdb->options;
                $where = 'option_name = %s LIMIT 1';
            } else {
                $optionTable = 'wp_st_options';
                if($user_id == 0)
                    $user_id = get_current_user_id();
                $where = "user_id = $user_id AND option_name = %s LIMIT 1";


            $option = trim($option);
            if (empty($option))
                return false;

            if (defined('WP_SETUP_CONFIG'))
                return false;
            $value = wp_cache_get($option, 'options');
            if (false === $value) {
                $suppress = $wpdb->suppress_errors();
                $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $optionTable WHERE {$where} ", $option));
                $wpdb->suppress_errors($suppress);
                if (is_object($row)){
                    $value = $row->option_value;
                    wp_cache_add($option, $value, 'options');
                }else
                    return $default;
            }

            return apply_filters('option_' . $option, maybe_unserialize($value));
        }
    }
$options = cronjob_get_option('stFacebookToolbox_1_settings', $id);
$option = $options['facebook_image_map'];
$image = explode('/wp-content/',$option['image']);
$image = get_bloginfo('url').'/wp-content/'.$image[1];
$image = substr($image,0,-4).'-thumb'.substr($image,-4);

?>
<style>
    div:hover {
        border: dashed 1px #FFFFFF; 
}
</style>
<img src="<?php echo $image;?>" width="520" />
 <?php foreach($wpdb->get_results("SELECT * FROM st_facebookimagemap WHERE user_id = ".$id) as $row){
                            $array =  explode(':',$row->begin);?>
<a href="<?php echo $row->link;?>" title="<?php echo $row->title;?>"><div style="background:none;position: absolute;top: <?php echo ($array[1]+12);?>px; left: <?php echo ($array[0]-12);?>px; width: <?php echo $row->width;?>px; height: <?php echo $row->height;?>px;color:#FFFFFF;cursor: pointer;" onclick="" ></div></a>
                            <?php }
                            ?>